////////////////////////////////////////////////////////
// Ganjek.cpp
////////////////////////////////////////////////////////

#include <d3d8.h>
#include "constants.h"
#include "MyEngine.h"
#include "Ganjek.h"

extern CMyEngine g_Engine;

////////////////////////////////////////////////////////
// HandleGanjek()
////////////////////////////////////////////////////////
void HandleGanjek()
{

    switch (g_Engine.GetPlayer()->GetSector())
    {
    case TrainingGroundsENTRANCE:
        g_Engine.SaveGame(FALSE);
        g_Engine.GetPlayer()->SetSector(1701);
        g_Engine.OpenMapFiles("TrainingGrounds.map", FALSE);
        g_Engine.SetCurrentMap(TrainingGrounds);
        g_Engine.GetCDirect3DObj()->SetCurrentTileSurface
            (g_Engine.GetCDirect3DObj()->GetTownExtTileSurface());
        g_Engine.ResetAnimation();
		g_Engine.GetCDirectSoundObj()->StopMusic(g_Engine.GetCDirectSoundObj()->GetCurrentlyPlaying());
		g_Engine.GetCDirectSoundObj()->PlayMusic(TrainingGroundsMusic);
        break;
    case SECONDTOWNENTRANCE:
        g_Engine.SaveGame(FALSE);
        g_Engine.GetPlayer()->SetSector(1700);
        g_Engine.OpenMapFiles("SecondTown.map", FALSE);
        g_Engine.SetCurrentMap(SECONDTOWN);
        g_Engine.GetCDirect3DObj()->SetCurrentTileSurface
            (g_Engine.GetCDirect3DObj()->GetTownExtTileSurface());
        g_Engine.ResetAnimation();
        break;
	}
}
